﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Common
{
   public class ErrorRecord
    {
        #region 获取服务器时间、把错误信息写入日志
        
        /// <summary>
        /// 将错误信息写入日志
        /// </summary>
        /// <param name="msg">错误信息</param>
        public  static void WriteErrorLog(string msg)
        {
            FileStream fs = new FileStream("ProjectError.log", FileMode.Append); //追加方式
            StreamWriter sw = new StreamWriter(fs);
            sw.WriteLine("【" + DateTime.Now.ToString() + "】错误信息：" + msg); //写入数据
            sw.Close();//关闭读写器
            fs.Close();//关闭文件
        }
        #endregion
    }
}
